package com.blue.user.controller;

import com.blue.starter.core.AjaxResult;
import com.blue.starter.pojo.user.domian.LitUserInfo;
import com.blue.starter.pojo.user.dto.LitUserInfoDto;
import com.blue.user.service.ILitUserInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

/**
 * @Author : CaiYang
 * @Date : 2025-03-21 15:00
 * @Description :
 */
@RestController
@RequestMapping("/user/info")
@RequiredArgsConstructor(onConstructor_ = @Autowired)
@Api(tags = "用户相关接口")
public class LitUserInfoController {

    private final ILitUserInfoService litUserInfoService;

    /**
     * 生成验证码
     * @param phone
     * @return
     */
    @ApiOperation("生成验证码")
    @GetMapping("/genPhoneCode")
    public AjaxResult genPhoneCode(String phone){
        return litUserInfoService.genPhoneCode(phone);
    }

    /**
     * 用户登录接口
     * @param litUserInfoDto
     * @return
     */
    @ApiOperation("用户登录")
    @PostMapping("/loginUser")
    public AjaxResult loginUser(@RequestBody LitUserInfoDto litUserInfoDto){
        System.out.println("执行方法！！");
        return litUserInfoService.loginUser(litUserInfoDto);
    }
}
